Ext.ns('AIR2');
/***************
 * AIR2
 *
 * Some global items in AIR2, that I'm really not sure where they should go
 * yet.
 *
 */
Ext.onReady(function() {
    Ext.QuickTips.init();
    Ext.Ajax.disableCaching = false;
});

// Placeholder for global remote exception handling
Ext.data.DataProxy.on('exception', function(proxy, type, action, options, response, arg) {
    Logger("A REMOTE EXCEPTION HAS OCCURRED!  (this is the global handler)");
    //Logger(proxy);
    //Logger(type);
    //Logger(action);
    //Logger(options);
    //Logger(response);
    //Logger(arg);
});

// constants, like in app/config/air2_constants.php
Ext.ns('AIR2.AUTHZ');
AIR2.AUTHZ.READER = 1;
AIR2.AUTHZ.WRITER = 2;
AIR2.AUTHZ.MANAGER = 4;

// extract an "object" from a prefixed object
// This is the client-side unpacking of the flatten_3dimensional_data()
// CRUD method.
AIR2.unflattenCRUDObj = function(obj, prefix) {
    if (obj[prefix]) {
        return obj[prefix];
    }
    var newObj = {};
    Ext.iterate(obj, function(k,v,o) {
        var s = k.split(':');
        //Logger(k, s);
        if (s && s.length == 2 && s[0] == prefix) {
            newObj[s[1]] = v;
        }
    });
    return newObj;
}

